<%--
  Created by IntelliJ IDEA.
  User: lqs
  Date: 2023/8/30
  Time: 12:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="application/javascript" src="layui/layui.js"></script>
<link rel="stylesheet" href="layui/css/layui.css">
<html>
<head>
    <title>Title</title>
  <style>
    table {

      width: 70%;
      border-collapse: collapse;
      position: relative;
      top: 100px;
      left: 340px;
    }

    table td, th {

      padding: 8px;
      text-align: left;
    }
    .div2{
      position: relative;
      top: 110px;
      left: 750px;
    }
    .div3{
      position: relative;
      top: 76px;
      left: 1075px;
    }
    .div4{
      position: relative;
      top: 45px;
      left: 336px;
    }
    #inputText{
      padding-left: 20px;
    }
  </style>

</head>
<body>

<table id="studentTable" lay-even lay-skin="line" lay-size="lg" >
  <tr style="border: 1px solid #b7b7b7;">
    <td>编号</td>
    <td>用户名</td>
    <td>密码</td>
    <td>创建时间</td>
    <td>手机号</td>
    <td>修改</td>
    <td>删除</td>

  </tr>

  <c:forEach items="${show}" var="show1">
    <tr style="border: 1px solid #b7b7b7;">
      <td>${show1.id}</td>
      <td>${show1.username}</td>
      <td>${show1.password}</td>
      <td>${show1.createtime}</td>
      <td>${show1.phone}</td>
      <td><button onclick="update(${show1.id})" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe642;</i></button></td>
      <td><button onclick="delect(${show1.id})" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe640;</i></button></td>
    </tr>
  </c:forEach>
</table>
<div>
  <div class="div2">
  <button onclick="frist1()" class="layui-btn layui-btn-sm ">首页</button>
  <button onclick="per()" class="layui-btn layui-btn-sm layui-btn-primary" ><i class="layui-icon layui-icon-left"></i></button>
  <button onclick="nex()" class="layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-right"></i></button>
  <button onclick="end1()" class="layui-btn layui-btn-sm ">页尾</button>
    一共有:${pageUntil.getPageTotal()}页
</div>
  <div class="div3">

  <form onsubmit="submitForm(event)">
    跳转到:<input type="text" id="inputText" style="width: 61px; height: 30px;" value="${pageUntil.pageIndex}">
    <button type="submit" class="layui-btn layui-btn-sm">确认</button>
  </form>
  </div>
</div>
<div class="div4"><button onclick="add()">添加</button></div>
<script>
  function delect(id){
    window.location.href="/delect?id="+id;
  }
  function update(id){
    window.location.href="/update?id="+id;
  }
  function add(){
    window.location.href="/add.jsp";
  }
  function submitForm(event) {
    event.preventDefault();
    var input = document.getElementById("inputText");
    var value = input.value;
    window.location.href = "/show?pageIndex=" + encodeURIComponent(value);
  }
  function frist1(){
    window.location.href="/show?pageIndex=1";
  }
  function per(){
    window.location.href="/show?pageIndex=${pageUntil.pageIndex-1<1?pageUntil.pageIndex:pageUntil.pageIndex-1}";
  }
  function nex(){
    window.location.href="/show?pageIndex=${pageUntil.pageIndex+1>pageUntil.pageTotal?pageUntil.pageIndex:pageUntil.pageIndex+1}";
  }
  function end1(){
    window.location.href="/show?pageIndex=${pageUntil.getPageTotal()}";
  }
</script>




</body>
</html>

